package javaBase.nowcoder.HJ85_A_最长回文子串;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        br.close();
        int max = 1;
        for (int i = 0; i < s.length(); i++) {
            int l1 = maxlength(i - 1, i, s);
            int l2 = maxlength(i, i, s);
            max = Math.max(max, Math.max(l1, l2));

        }
        System.out.println(max);
    }

    public static int maxlength(int left, int right, String s) {
        while (left >= 0 && right < s.length() && s.charAt(left) == s.charAt(right)) {
            left--;
            right++;
        }
        return right - left - 1;
    }
}
